Skip to content

Comments

rubydoc: fix sidebar navigation links on nested pages#21589

Open
GunniBusch wants to merge 2 commits intoHomebrew:mainfrom
GunniBusch:fix-rdoc
Open

rubydoc: fix sidebar navigation links on nested pages#21589
GunniBusch wants to merge 2 commits intoHomebrew:mainfrom
GunniBusch:fix-rdoc

Conversation

@GunniBusch
Copy link

@GunniBusch GunniBusch commented Feb 18, 2026

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

This fixes #21588
It headers.erb and adds a base tag

Copilot AI review requested due to automatic review settings February 18, 2026 04:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Homebrew’s overridden YARD app.js to fix broken sidebar navigation when browsing nested RubyDoc pages (as reported in #21588), and makes minor docstring formatting tweaks in an autogenerated Sorbet RBI.

Changes:

  • Add/override YARD template app.js with a postMessage-driven navigation handler that fetches and swaps #main content for sidebar navigation.
  • Re-run/adjust parts of the page-init logic after dynamic navigation.
  • Minor comment formatting changes in parser@3.3.8.0.rbi.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 6 comments.

File Description
Library/Homebrew/yard/templates/default/fulldoc/html/js/app.js Overrides YARD JS to handle sidebar navigation on nested pages by resolving URLs and swapping main content.
Library/Homebrew/sorbet/rbi/parser@3.3.8.0.rbi Small docstring formatting changes in an autogenerated RBI file.
Files not reviewed (1)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of extra code added for what should be a relatively simple regression?

@p-linnane does this related to the recent GitHub Pages work perhaps?

@GunniBusch

This comment was marked as outdated.

@GunniBusch

This comment was marked as resolved.

@GunniBusch
Copy link
Author

GunniBusch commented Feb 22, 2026

Ok I managed to remove the big app.js file.

I overrode https://github.com/lsegal/yard/blob/eddd10c3948021c34a887db403824ce5a892708b/templates/default/layout/html/headers.erb and added <base href='<%= u = url_for(''); u + (u != '' ? '/' : '') %>';'>. The content of the href part, has to be the relative url pointing to the base i.e. how to get to /rbdoc? or locally brew/docs` from the current path. To achieve this, I just reused the base bath detection from this template https://github.com/lsegal/yard/blob/eddd10c3948021c34a887db403824ce5a892708b/templates/default/layout/html/script_setup.erb#L3

The rbi file could be removed, but I could not generate the docs without the correct rbi of parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rubydoc: sidebar redirects with wrong url

2 participants